
public class Simulation
{
	private static double collisionTime;
	private static BillardBall ball0,ball1;
	private static int currTime;
	
	public static void start(BillardBall ball0, BillardBall ball1)
	{
		currTime = 0;
		Simulation.ball0 = ball0;
		Simulation.ball1 = ball1;
		Interaction i = new Interaction(ball0,ball1);
		collisionTime=i.getTime();
	}
	
	public static void advanceTime(int t)
	{
		if(t<=0)
		{
			throw new RuntimeException();
		}
		currTime += t;
		if(t<collisionTime)
		{
			if(!ball0.getVelocity().isZero())
			{
				ball0.setPosition(ball0.getPosition().add(ball0.getVelocity().multiply(currTime-ball0.getTime())));
				ball0.setTime(currTime);
			}
			if(!ball1.getVelocity().isZero())
			{
				ball1.setPosition(ball1.getPosition().add(ball1.getVelocity().multiply(currTime-ball1.getTime())));
				ball1.setTime(currTime);
			}
		}
		else
		{
			
		}
	}
}
